def sortirovka(sp):
    f1 = open(sp)
    a = [int(el.strip()) for el in f1.readlines()]
    f1.close()


    n = len(a)
    import time
    start = time.time()
    for i in range(n - 1):
        for j in range(n - i - 1):
            if a[j] > a[j + 1]:
                a[j], a[j + 1] = a[j + 1], a[j]
    finish = time.time()
    t = round((finish-start)*1000)
    print(sp[:-4:], t, 'milliseconds')   


sortirovka('m1_sorted.txt')
sortirovka('m2_reverse.txt')
sortirovka('m3_shuffle.txt')
